package com.qtu.user_service.feign;

import com.qtu.user_service.feign.fallback.OpenClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Service
@FeignClient(value = "redis-service",fallback = OpenClientFallBack.class)
public interface OpenClient {
    @PostMapping("api/redis/set")
    String set(@RequestParam("key") String key, @RequestBody Object value);

    @PostMapping("api/redis/exists")
    public String exists(@RequestParam("key") String key);

    @RequestMapping(value = "api/redis/setByTime")
    public String setByTime(@RequestParam("key") String key, @RequestBody Object value, @RequestParam("time")long time);

    @PostMapping("api/redis/expire")
    public String expire(@RequestParam("key") String key,@RequestParam("time") long time);

    @RequestMapping("api/redis/delete")
    public String delete(@RequestParam("key") String key);

    @RequestMapping("api/redis/get")
    public Object get(@RequestParam("key") String key);
}
